package com.yiwei.zxp.api.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xsooy-pc on 18-5-25.
 */

public class BuyListBean implements Parcelable {


    public List<ItemsBean> items;

    public static class ItemsBean implements Parcelable {
        /**
         * shop_id : 110
         * goods : [{"goods_no":"201805241015b06791423a7e","num":3},{"goods_no":"201805241012b06791423a7e","num":2}]
         */

        public String shop_id;
        public List<GoodsBean> goods;

        public static class GoodsBean implements Parcelable {
            public GoodsBean(String goods_no, String num) {
                this.goods_no = goods_no;
                this.num = num;
            }

            /**
             * goods_no : 201805241015b06791423a7e
             * num : 3
             */



            public String goods_no;
            public String num;

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(this.goods_no);
                dest.writeString(this.num);
            }

            protected GoodsBean(Parcel in) {
                this.goods_no = in.readString();
                this.num = in.readString();
            }

            public static final Creator<GoodsBean> CREATOR = new Creator<GoodsBean>() {
                @Override
                public GoodsBean createFromParcel(Parcel source) {
                    return new GoodsBean(source);
                }

                @Override
                public GoodsBean[] newArray(int size) {
                    return new GoodsBean[size];
                }
            };
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.shop_id);
            dest.writeList(this.goods);
        }

        public ItemsBean() {
        }

        protected ItemsBean(Parcel in) {
            this.shop_id = in.readString();
            this.goods = new ArrayList<GoodsBean>();
            in.readList(this.goods, GoodsBean.class.getClassLoader());
        }

        public static final Creator<ItemsBean> CREATOR = new Creator<ItemsBean>() {
            @Override
            public ItemsBean createFromParcel(Parcel source) {
                return new ItemsBean(source);
            }

            @Override
            public ItemsBean[] newArray(int size) {
                return new ItemsBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(this.items);
    }

    public BuyListBean() {
    }

    protected BuyListBean(Parcel in) {
        this.items = new ArrayList<ItemsBean>();
        in.readList(this.items, ItemsBean.class.getClassLoader());
    }

    public static final Parcelable.Creator<BuyListBean> CREATOR = new Parcelable.Creator<BuyListBean>() {
        @Override
        public BuyListBean createFromParcel(Parcel source) {
            return new BuyListBean(source);
        }

        @Override
        public BuyListBean[] newArray(int size) {
            return new BuyListBean[size];
        }
    };
}
